package cn.dnuihyy406.dnuifood_16110100406.model;


import cn.dnuihyy406.dnuifood_16110100406.iface.GetfoodIface;
import cn.dnuihyy406.dnuifood_16110100406.listener.OnRetrofitListener;
import cn.dnuihyy406.dnuifood_16110100406.service.CollectService;
import cn.dnuihyy406.dnuifood_16110100406.service.GetfoodService;
import retrofit2.Call;

public class GetfoodModel extends BaseModel implements GetfoodIface{
    private GetfoodService getfoodService;
    private CollectService collectService;

    public GetfoodModel(){
        super();
        getfoodService=retrofit.create(GetfoodService.class);
        collectService=retrofit.create(CollectService.class);
    }
    @Override
    public void isCollected(String user_id, String shop_food_id, String flag, OnRetrofitListener listener) {
        Call call = collectService.isCollected(user_id,shop_food_id,flag);
        bindCallBack(call,listener,5);
    }

    @Override
    public void userCollectFood(String user_id, String food_id, OnRetrofitListener listener) {
        Call call = collectService.userCollectFood(user_id,food_id);
        bindCallBack(call,listener,6);
    }

    @Override
    public void getFoodById(String food_id, OnRetrofitListener listener) {
        Call call = getfoodService.getFoodById(food_id);
        bindCallBack(call,listener,7);
    }

    @Override
    public void getAllCommentsByFood(String food_id, OnRetrofitListener listener) {
        Call call = getfoodService.getAllCommentsByFood(food_id);
        bindCallBack(call,listener,8);
    }

    @Override
    public void insertOrder(String user_id, String food_id, String num, String sum, String suggesttime, String address, OnRetrofitListener listener) {
        Call call=getfoodService.insertOrder(user_id,food_id,num,sum,suggesttime,address);
        bindCallBack(call,listener,21);
    }
}
